<template>
	<view class="page-e tn-safe-area-inset-bottom">

		<!-- 顶部自定义导航 -->
		<!-- <tn-nav-bar :isBack="false" :bottomShadow="false" backgroundColor="none">
      <view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left" @click="tn('')">
        <view class="custom-nav__back">
          <text class="tn-text-bold tn-text-xl tn-color-black">个人中心</text>
        </view>
      </view>
    </tn-nav-bar> -->

		<view class="top-backgroup">
			<image class='backgroud-image' mode='widthFix' src='https://lemawuyou.oss-cn-shanghai.aliyuncs.com/client/images/mine/my-bg4.png'></image>
		</view>

		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}" class="tn-margin-left tn-margin-right">
			<view v-if="userInfoObj"
				class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-bottom" style="margin-top: -450rpx;">
				<view class="justify-content-item">
					<view class="tn-flex tn-flex-col-center tn-flex-row-left">
						<view class="logo-pic tn-shadow">
							<view class="logo-image" @click="tn('/pages/login/index')">
								<view :style="{backgroundImage: `url(${userInfoObj.headSculpture||''})`}"
									class="tn-shadow-blur"
									style="width: 110rpx;height: 110rpx;background-size: cover;overflow: hidden;">
								</view>
							</view>
						</view>
						<view class="tn-padding-right">
							<view class="tn-padding-right tn-padding-left-sm" @click="tn('/pages/login/index')">
								<text class="tn-color-wallpaper tn-text-xl tn-text-bold">
									{{ userInfoObj.nickname }}
								</text>
								<!--                <text v-else class=" tn-round tn-text-sm tn-bg-red tn-color-white tn-margin-left-sm"
                                      style="padding: 10rpx 20rpx;">
                                  未注册
                                </text>-->
							</view>
							<view class="tn-padding-right tn-padding-top-xs tn-padding-left-sm tn-text-ellipsis">
								<text class="tn-color-gray">{{ userInfoObj.roleKey === 'agent' ? '代理' : '会员' }}</text>
								<span @click="copyShareCode(userInfoObj.shareCode)">
									<text
										class="tn-color-gray tn-padding-left-sm tn-text-sm">{{ userInfoObj.shareCode }}</text>
									<text class="tn-icon-copy-fill tn-margin-xs"></text>
								</span>
							</view>
						</view>
					</view>
				</view>
				<!--
        //设置图标
           <view class="justify-content-item">
                  <view class="tn-icon-install tn-color-gray tn-text-xxl">
                  </view>
                </view>-->
			</view>

			<!-- 没有授权，则显示这个授权按钮-->
			<view v-else class="tn-flex tn-flex-row-between" style="margin-top:-258px;"
				@click="tn('/pages/login/index')">
				<view class="tn-flex-1 justify-content-item tn-margin-xs tn-text-center">
					<tn-button backgroundColor="#1D2541" fontColor="#ffffff" padding="20rpx 0" shadow shape="round"
						width="40%">
						<text class="tn-icon-wechat tn-padding-right-xs tn-text-xl"></text>
						<text class="">授权登录</text>
					</tn-button>
				</view>
			</view>

			<view>
				<view v-if="userInfoObj.id" class="tn-margin-top-xl">
					<view class="button-number tn-flex tn-flex-row-between tn-flex-col-center tn-shadow-blur"
						style="background: linear-gradient(-120deg, #3E445A, #31374A, #2B3042, #262B3C);">
						<view class="tn-margin-left">
							<view class='title' style="color: #F1C68E;">
								<text class="tn-text-bold tn-text-xl">赚佣金</text>
								<text class="tn-icon-vip-text tn-text-center"
									style="position: absolute;margin: -22rpx 0 0 0;font-size: 92rpx;"></text>
							</view>
							<view class='tn-color-white tn-text-sm tn-padding-top-sm'>邀请好友赚佣金</view>
						</view>
						<view class="tn-margin-right">
							<tn-button backgroundColor="#F1C68E" fontColor="#634738" open-type="share" padding="10rpx 0"
								shadow shape="round" width="160rpx">
								<text class="tn-icon-vip tn-padding-right-sm tn-text-lg"></text>
								<text class="tn-text-bold">邀 请</text>
							</tn-button>
						</view>

					</view>
				</view>

				<!-- 方式12 start-->
				<view v-if="userInfoObj.id"
					class="wallpaper-shadow tn-margin-top-lg tn-padding-top-sm tn-padding-bottom-sm tn-bg-white">
					<view class="tn-flex tn-flex-row-center tn-radius tn-padding-top">
						<view class="tn-padding-sm tn-margin-xs tn-radius" style="width: 25%;" @click="to(0)">
							<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
								<view
									class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-grey--light">
									<view class="tn-icon-pay tn-color-wallpaper"></view>
								</view>
								<view class="tn-text-center">
									<text class="tn-text-ellipsis">待付款</text>
								</view>
							</view>
						</view>
						<view class="tn-padding-sm tn-margin-xs tn-radius" style="width: 25%;" @click="tn('/minepages/subOrder?type=0')">
							<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
								<view
									class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-grey--light">
									<view class="tn-icon-bankcard tn-color-wallpaper"></view>
								</view>
								<view class="tn-text-center">
									<text class="tn-text-ellipsis">子订单</text>
								</view>
							</view>
						</view>
						<view class="tn-padding-sm tn-margin-xs tn-radius" style="width: 25%;" @click="tn('/minepages/remainEvaluated')">
							<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
								<view
									class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-grey--light">
									<view class="tn-icon-comment tn-color-wallpaper"></view>
								</view>
								<view class="tn-text-center">
									<text class="tn-text-ellipsis">待评价</text>
								</view>
							</view>
						</view>
						<view class="tn-padding-sm tn-margin-xs tn-radius"
							@click="tn('/minepages/wallet')">
							<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
								<view
									class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-bg-grey--light">
									<view class="tn-icon-money tn-color-wallpaper"></view>
								</view>
								<view class="tn-text-center">
									<text class="tn-text-ellipsis">钱包</text>
								</view>
							</view>
						</view>
					</view>
				</view>

				<!-- 更多信息-->
				<view
					class="wallpaper-shadow tn-margin-top-lg tn-padding-top-sm tn-padding-bottom-sm">
<!--					<tn-list-cell v-if="userInfoObj.roleKey !== 'custom' && userInfoObj.roleKey" :fontSize="30" :hover="true" :radius="true" :unlined="true"-->
<!--						@click="tn('/minepages/invited')">-->
<!--						<view class="tn-flex tn-flex-col-center">-->
<!--							<view class="icon1__item&#45;&#45;icon tn-flex tn-flex-row-center tn-flex-col-center"-->
<!--								style="color: #7C8191;">-->
<!--								<view class="tn-icon-my-add"></view>-->
<!--							</view>-->
<!--							<view class="tn-margin-left-sm tn-flex-1">受邀客户</view>-->
<!--							<view class="tn-color-gray tn-icon-right"></view>-->
<!--						</view>-->
<!--					</tn-list-cell >-->
					<tn-list-cell v-if="userInfoObj.roleKey !== 'custom' && userInfoObj.roleKey" :fontSize="30" :hover="true" :radius="true" :unlined="true"
						@click="tn('/minepages/transaction')">
						<view class="tn-flex tn-flex-col-center">
							<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
								style="color: #7C8191;">
								<view class="tn-icon-paperbag"></view>
							</view>
							<view class="tn-margin-left-sm tn-flex-1">交易情况</view>
							<view class="tn-color-gray tn-icon-right"></view>
						</view>
					</tn-list-cell>
          <tn-list-cell v-if="userInfoObj.id" :fontSize="30" :hover="true" :radius="true" :unlined="true"
                        @click="tn('/minepages/groupBuy')">
            <view class="tn-flex tn-flex-col-center">
              <view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
                    style="color: #7C8191;">
                <view class="tn-icon-buy"></view>
              </view>
              <view class="tn-margin-left-sm tn-flex-1">我的团购</view>
              <view class="tn-color-gray tn-icon-right"></view>
            </view>
          </tn-list-cell>
					<!--        <tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true">
                    <button class="tn-flex tn-flex-col-center tn-button&#45;&#45;clear-style" open-type="share">
                      <view
                          class="icon1__item&#45;&#45;icon tn-flex tn-flex-row-center tn-flex-col-center" style="color: #7C8191;">
                        <view class="tn-icon-plane-fill"></view>
                      </view>
                      <view class="tn-flex tn-flex-row-between" style="width: 100%;">
                        <view class="tn-margin-left-sm">转发邀请</view>
                        <view class="tn-color-gray tn-icon-right"></view>
                      </view>
                    </button>
                  </tn-list-cell>-->
				</view>
			</view>
			<view class="wallpaper-shadow tn-margin-top-lg tn-margin-bottom-lg tn-padding-top-sm tn-padding-bottom-sm">
				<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true">
					<button class="tn-flex tn-flex-col-center tn-button--clear-style" open-type="contact">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-wechat-fill"></view>
						</view>
						<view class="tn-flex tn-flex-row-between" style="width: 100%;">
							<view class="tn-margin-left-sm">联系客服</view>
							<view class="tn-color-gray tn-icon-right"></view>
						</view>
					</button>
				</tn-list-cell>
				<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" @click="shouqianModal = true">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-email-fill"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">售前微信</view>
						<view class="tn-color-gray tn-icon-right"></view>
					</view>
				</tn-list-cell>
				<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true">
					<button class="tn-flex tn-flex-col-center tn-button--clear-style" open-type="feedback">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-message-fill"></view>
						</view>
						<view class="tn-flex tn-flex-row-between" style="width: 100%;">
							<view class="tn-margin-left-sm">问题反馈</view>
							<view class="tn-color-gray tn-icon-right"></view>
						</view>
					</button>
				</tn-list-cell>
				<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" @click="tn('/minepages/platformAgreement')">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-bookmark"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">平台协议</view>
						<view class="tn-color-gray tn-icon-right"></view>
					</view>
				</tn-list-cell>
				<!-- <tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" @click="tn('/minepages/orderEvaluation')">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-star"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">订单评价</view>
						<view class="tn-color-gray tn-icon-right"></view>
					</view>
				</tn-list-cell> -->
									<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" @click="tn('/minepages/communique')">
						<view class="tn-flex tn-flex-col-center">
							<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
								style="color: #7C8191;">
								<view class="tn-icon-topic"></view>
							</view>
							<view class="tn-margin-left-sm tn-flex-1">官方公告</view>
							<view class="tn-color-gray tn-icon-right"></view>
						</view>
					</tn-list-cell>
					<!-- <tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" @click="tn('/minepages/businessInformation')">
						<view class="tn-flex tn-flex-col-center">
							<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
								style="color: #7C8191;">
								<view class="tn-icon-user"></view>
							</view>
							<view class="tn-margin-left-sm tn-flex-1">商家资料</view>
							<view class="tn-color-gray tn-icon-right"></view>
						</view>
					</tn-list-cell> -->
				<tn-list-cell :fontSize="30" :hover="true" :radius="true" :unlined="true" data-number="18266666666"
					@click="callPhoneNumber">
					<view class="tn-flex tn-flex-col-center">
						<view class="icon1__item--icon tn-flex tn-flex-row-center tn-flex-col-center"
							style="color: #7C8191;">
							<view class="tn-icon-tel-circle-fill"></view>
						</view>
						<view class="tn-margin-left-sm tn-flex-1">技术支持</view>
						<view
							class="tn-margin-left-sm tn-color-wallpaper tn-text-sm tn-padding-left-xs tn-padding-right-xs tn-bg-gray--light tn-round">
							182****9366
						</view>
					</view>
				</tn-list-cell>
			</view>

		</view>

		<tn-modal v-model="shouqianModal" :custom="true">
			<view class="custom-modal-content">
				<image mode='aspectFit' src='https://itclub.oss-cn-beijing.aliyuncs.com/presales/presale.jpg'
					style="width: 100%;" @tap="previewQRCodeImage"></image>
				<view class="tn-text-center tn-padding-top" @click="copyShareCode('zyd-74521')">
					<text class="">售前微信：zyd-74521</text>
					<text class="tn-color-blue--disabled tn-padding-left-xs tn-text-df tn-icon-copy"></text>
				</view>
				<view class="tn-text-center tn-padding-top tn-text-lg">点击上图，可识别微信二维码</view>
			</view>
		</tn-modal>

		<view class='tn-tabbar-height'></view>
		<view class="bg-tabbar-shadow"></view>

	</view>
</template>

<script>
	export default {
		name: 'Mine',
		// props: {
		//   userInfoObj: {
		//     type: Object,
		//     default: function () {
		//       return {}
		//     }
		//   }
		// },
		data() {
			return {
				userInfoObj: {},
				shouqianModal: false
			}
		},
		onReady() {
			this.userInfoObj = this.$store.getters.getUserInfo
		},
		methods: {
      refresh() {
        this.userInfoObj = this.$store.getters.getUserInfo
      },
			goWallet() {
				uni.showToast({
					title: '功能开发中',
					duration: 2000,
					icon: 'none'
				});
			},
			to(type) {
				uni.navigateTo({
					url: `/minepages/order?type=${type}`,
				})
			},
			// 跳转
			tn(e) {
        if(e === "/pages/login/index") {
          uni.navigateTo({
            url: e + `?type=update`,
          })
          return;
        }
				uni.navigateTo({
					url: e,
				});
			},
			previewQRCodeImage() {
				wx.previewImage({
					urls: ['https://itclub.oss-cn-beijing.aliyuncs.com/presales/presale.jpg']
				})
			},
			//拨打固定电话
			callPhoneNumber() {
				uni.makePhoneCall({
					phoneNumber: "18266029366",
				});
			},
			/*    // 复制开源地址
			    copySource() {
			      wx.vibrateShort();
			      uni.setClipboardData({
			        data: "https://ext.dcloud.net.cn/publisher?id=356088",
			      })
			    },*/
			copyShareCode(shareCode) {
				uni.setClipboardData({
					data: shareCode,
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-e {
		max-height: 100vh;
	}

	/* 底部安全边距 start*/
	.tn-tabbar-height {
		min-height: 120rpx;
		height: calc(140rpx + env(safe-area-inset-bottom) / 2);
		height: calc(140rpx + constant(safe-area-inset-bottom));
	}

	/* 底部tabbar假阴影 start*/
	.bg-tabbar-shadow {
		// background-image: repeating-linear-gradient(to top, rgba(0,0,0,0.1) 10rpx, rgba(255,255,255,0) , rgba(255,255,255,0));
		box-shadow: 0rpx 0rpx 400rpx 0rpx rgba(0, 0, 0, 0.25);
		position: fixed;
		bottom: calc(0rpx + env(safe-area-inset-bottom) / 2);
		bottom: calc(0rpx + constant(safe-area-inset-bottom));
		height: 60rpx;
		width: 100vw;
		z-index: 0;
	}

	.tn-color-wallpaper {
		color: #1D2541;
	}


	/* 自定义导航栏内容 start */
	.custom-nav {
		height: 100%;

		&__back {
			margin: auto 30rpx;
			font-size: 40rpx;
			margin-right: 10rpx;
			flex-basis: 5%;
			width: 100rpx;
			position: absolute;
		}
	}

	/* 自定义导航栏内容 end */

	/* 顶部背景图 start */
	.top-backgroup {
		height: 450rpx;
		z-index: -1;

		.backgroud-image {
			width: 100%;
			height: 450rpx;
			// z-index: -1;
		}
	}

	/* 顶部背景图 end */


	/* 图标容器5 start */
	.icon5 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 0rpx;
			margin: 0rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 96rpx;
				height: 96rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;
			}
		}
	}

	/* 用户头像 start */
	.logo-image {
		width: 110rpx;
		height: 110rpx;
		position: relative;
		overflow: hidden;
		border-radius: 50%;
	}

	.logo-pic {
		background-size: cover;
		background-repeat: no-repeat;
		// background-attachment:fixed;
		background-position: top;
		border: 8rpx solid rgba(255, 255, 255, 0.05);
		box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
		border-radius: 50%;
		overflow: hidden;
		// background-color: #FFFFFF;
	}

	/* 页面阴影 start*/
	.wallpaper-shadow {
		border-radius: 15rpx;
		box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
	}

	/* 页面阴影 end*/

	/* 图标容器15 start */
	.icon15 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;


				}
			}
		}
	}

	/* 图标容器12 start */
	.tn-three {
		position: absolute;
		top: 50%;
		right: 50%;
		bottom: 50%;
		left: 50%;
		transform: translate(-38rpx, -16rpx) rotateX(30deg) rotateY(20deg) rotateZ(-30deg);
		text-shadow: -1rpx 2rpx 0 #f0f0f0, -2rpx 4rpx 0 #f0f0f0, -10rpx 20rpx 30rpx rgba(0, 0, 0, 0.2);
	}

	.icon20 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 100rpx;
				height: 100rpx;
				font-size: 60rpx;
				border-radius: 50%;
				margin-bottom: 18rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg.png);
				}
			}
		}
	}


	/* 积分数字 */
	.button-number {
		width: 100%;
		height: 150rpx;
		border-radius: 15rpx;
		position: relative;
		z-index: 1;

		&::after {
			content: " ";
			position: absolute;
			z-index: -1;
			width: 100%;
			height: 100%;
			left: 0;
			bottom: 0;
			border-radius: inherit;
			opacity: 1;
			transform: scale(1, 1);
			background-size: 100% 100%;
			background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg.png);
		}
	}


	/* 图标容器12 start */
	.icon12 {
		&__item {
			width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 15rpx;
				height: 15rpx;
				font-size: 50rpx;
				border-radius: 50%;
				margin-bottom: 38rpx;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;

				}
			}
		}
	}

	/* 图标容器1 start */
	.icon1 {
		&__item {
			// width: 30%;
			background-color: #FFFFFF;
			border-radius: 10rpx;
			padding: 30rpx;
			margin: 20rpx 10rpx;
			transform: scale(1);
			transition: transform 0.3s linear;
			transform-origin: center center;

			&--icon {
				width: 40rpx;
				height: 40rpx;
				font-size: 40rpx;
				border-radius: 50%;
				position: relative;
				z-index: 1;

				&::after {
					content: " ";
					position: absolute;
					z-index: -1;
					width: 100%;
					height: 100%;
					left: 0;
					bottom: 0;
					border-radius: inherit;
					opacity: 1;
					transform: scale(1, 1);
					background-size: 100% 100%;
					background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg.png);
				}
			}
		}
	}

	/* 图标容器1 end */
</style>